#include <algorithm>
#include <cmath>
#include <cstdio>

const int N = 3e5 + 5;
const double eps = 1e-8, inf = 1e18;

int n, ori, tar, crash, A, e_cnt, heads[N];
int fa[N], deg[N], from1[N], from2[N];
double f1[N], f2[N], g[N], ans, mid;

inline int sign(double x) { return x == 0 ? 0 : (x > 0 ? 1 : -1); }

struct Person {
  int power, point;
  inline double operator()(double rpoint) const {
    double dpoi = point - rpoint, dpow = power - mid;
    double delta = 2 * sign(dpow) * (sqrt((dpow > 0 ? dpow : -dpow) + 1) - 1) -
                   A * sign(dpoi) * (sqrt((dpoi > 0 ? dpoi : -dpoi) + 1) - 1);
    return rpoint - delta;
  }
} p[N];

struct Edge {
  int v, nxt;
} e[N << 1];

inline void add(int u, int v) {
  e[++e_cnt].v = v, e[e_cnt].nxt = heads[u];
  heads[u] = e_cnt, ++deg[u];
}

void dfs1(int u) {
  f1[u] = -inf, f2[u] = -inf;
  from1[u] = from2[u] = 0;
  if (deg[u] == 1 && u != 1) f1[u] = p[u](ori);
  for (int i = heads[u], v; i; i = e[i].nxt) {
    if ((v = e[i].v) != fa[u]) {
      fa[v] = u;
      dfs1(v);
      double tmp = p[u](f1[v]);
      if (tmp > f2[u]) from2[u] = v, f2[u] = tmp;
      if (f2[u] > f1[u]) std::swap(f2[u], f1[u]), std::swap(from2[u], from1[u]);
    }
  }
}

void dfs2(int u) {
  if (deg[u] <= 1) ans = std::max(ans, std::max(g[u], f1[u]));
  for (int i = heads[u], v; i; i = e[i].nxt) {
    if ((v = e[i].v) != fa[u]) {
      double tmp = from1[u] == v ? f2[u] : f1[u];
      tmp = std::max(tmp, g[u]);
      g[v] = p[v](tmp);
      dfs2(v);
    }
  }
}

inline bool check() {
  ans = -inf;
  if (deg[1] <= 1) g[1] = p[1](ori);
  else
    g[1] = -inf;
  dfs1(1), dfs2(1);
  return ans >= tar;
}

double solve() {
  double l = -1e7, r = 1e7;
  while (r - l > eps) {
    mid = (l + r) / 2;
    if (check()) r = mid;
    else
      l = mid;
  }
  return l;
}

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#else
  freopen("pigeatyy.in", "r", stdin);
  freopen("pigeatyy.out", "w", stdout);
#endif
#endif

  scanf("%d%d%d%d%d", &crash, &n, &ori, &tar, &A);
  for (int i = 2, u, v; i <= n; i++) {
    scanf("%d%d", &u, &v);
    add(u, v), add(v, u);
  }
  for (int i = 1; i <= n; i++) scanf("%d%d", &p[i].power, &p[i].point);
  printf("%.6lf\n", solve());
  return 0;
}